

#include "sys.h"
uint16_t *ADC_buff; // 接收ADC的的值
int speed_L = 0;
int speed_R = 0;
_pid MyPID;
uint8_t     A_ryy[5]={0x5,0x2,0x1,0x2,0x6};
uint16_t    A_num=0x32;
float   A_ds=50.23;
int A_bs;
int main(void)
{
    MAP_WDT_A_holdTimer();
    SysInit();
    UARTA0_Init(); // TX3.3   RX3.2
    OLED_Init();
    OLED_Clear();
    NVIC_confing();
    protocol_init();
    UART_Send_Hexnum(EUSCI_A0_BASE, 0x25);
    // GPIO_setAsInputPin(GPIO_PORT_P1, GPIO_PIN6);
//    GPIO_getInputPinValue(GPIO_PORT_P1, GPIO_PIN6);
//    UART_Send_Hexarry(EUSCI_A0_BASE,A_ryy,5);
//    UART_Send_Hexarry(EUSCI_A0_BASE,(uint8_t *)&set_packet,sizeof(set_packet));
    
    while (1)
    {
        OLED_ShowNum(1,1,A_bs,10,8);
        A_bs=A_ds;
        set_computer_value(SEND_FACT_CMD,CURVES_CH1,&A_bs,1);
        receiving_process();
    }
}
void TA0_0_IRQHandler(void)
{
    static uint8_t i;
    i++;
    speed_L = read_L();
    speed_R = read_R();
    Timer_A_clearCaptureCompareInterrupt(TIMER_A0_BASE, TIMER_A_CAPTURECOMPARE_REGISTER_0);
    if (i == 20)
    {
        i = 0;
        LED_G_Tog();
    }
}
